<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="/css/plugins/datepicker/datepicker3.css" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">


    <div class="row">
        @if(count($errors) > 0)
            @foreach($errors->all() as $error)
                <div class="alert alert-danger">{{ $error }}</div>
            @endforeach
        @endif
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>渠道 <small>添加</small></h5>
                </div>
                <div class="ibox-content">
                    <form method="post" action="/ceb/channels/store" class="form-horizontal">
                        {{csrf_field()}}
                        <div class="form-group">
                            <label class="col-sm-2 control-label">渠道名称：</label>
                            <div class="col-sm-6">
                                <div class="row">
                                    <div class="col-md-8">
                                        <input type="text" value="{{ $channel_provider->name }}"
                                               readonly class="form-control">
                                        <input name="channel_provider_id" type="text" value="{{ $channel_provider->id }}" class="hidden">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group @if($errors->has('code') || $errors->has('code')) has-error @endif">
                            <label class="col-sm-2 control-label">渠道代码：</label>
                            <div class="col-sm-4">
                                <div class="row">
                                    <div class="col-md-12">
                                        <input type="text" name="code" value="{{ old('code') }}"
                                               placeholder="渠道代码" class="form-control">
                                        <span class="help-block m-b-none">{{$errors->first('code')}}</span>
                                    </div>
                                </div>
                            </div>
                            <label class="col-sm-2 control-label">渠道号：</label>
                            <div class="col-sm-4">
                                <div class="row">
                                    <div class="col-md-12">
                                        <input type="text" name="no" value="{{ old('no') }}"
                                               placeholder="渠道号" class="form-control">
                                        <span class="help-block m-b-none">{{$errors->first('no')}}</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">合作方式：</label>
                            <div class="col-sm-10">
                                <div class="row">
                                    <div class="col-md-12">
                                        @foreach($cooperation_list as $type => $cooperation)
                                            <label class="radio-inline">
                                                    <input type="radio" name="cooperation" value="{{ $type }}">
                                                {{ $cooperation['name'] }}
                                            </label>
                                        @endforeach
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">合作目标：</label>
                            <div class="col-sm-6">
                                <div class="row">
                                    <div class="col-md-8">
                                        @foreach($target_list as $type => $target)
                                            <label class="radio-inline">
                                                <input type="radio" name="target" value="{{ $type }}">
                                                {{ $target['name'] }}
                                            </label>
                                        @endforeach
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">合作周期：</label>
                            <div class="col-sm-6">
                                <div class="row">
                                    <div class="input-daterange input-group" id="datepicker">
                                        <input type="text" class="input-sm form-control _date" name="start_date" value="{{ date('Y-m-d') }}" />
                                        <span class="input-group-addon"> —— </span>
                                        <input type="text" class="input-sm form-control _date" name="end_date" value="{{ date('Y-m-d') }}" />
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">合作类型：</label>
                            <div class="col-sm-6">
                                <div class="row">
                                    <div class="col-md-8">
                                        @foreach($contract_list as $type => $contract)
                                            <label class="radio-inline">
                                                <input type="radio" name="contract_type" value="{{ $type }}">
                                                {{ $contract['name'] }}
                                            </label>
                                        @endforeach
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="form-group @if($errors->has('amount')) has-error @endif">
                            <label class="col-sm-2 control-label">合同金额：</label>
                            <div class="col-sm-6">
                                <div class="row">
                                    <div class="col-md-8">
                                        <input type="text" name="contract_amount" value="{{ old('contract_amount') }}"
                                               placeholder="合同金额" class="form-control">
                                        <span class="help-block m-b-none">{{$errors->first('contract_amount')}}</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group @if($errors->has('expections')) has-error @endif">
                            <label class="col-sm-2 control-label">预期效果：</label>
                            <div class="col-sm-6">
                                <div class="row">
                                    <div class="col-md-8">
                                        <textarea name="expections" class="form-control"
                                                  placeholder="预期效果" rows="5"></textarea>
                                        <span class="help-block m-b-none">{{$errors->first('expections')}}</span>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="submit">提 交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.6"></script>

<!-- 自定义js -->
<script src="/js/content.js?v=1.0.0"></script>

<!-- iCheck -->
<script src="/js/plugins/iCheck/icheck.min.js"></script>
<script src="/js/plugins/datepicker/bootstrap-datepicker.js"></script>
<script>
    $(document).ready(function () {
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });

        $('._date').on('change',initDate).datepicker({
            startView: 1,
            todayBtn: "linked",
            keyboardNavigation: false,
            forceParse: false,
            autoclose: true,
            format: "yyyy-mm-dd"
        });

        var start = $('input[name=start_date]');
        var end = $('input[name=end_date]');
        var pStart = start.data('datepicker');
        var pEnd = end.data('datepicker');

        function initDate(){
            var sDate = pStart.getDate();
            var eDate = pEnd.getDate();
            pStart.setEndDate(eDate);
            pEnd.setStartDate(sDate);
        }
    });
</script>

<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
<!--统计代码，可删除-->

</body>

</html>
